package com.beiming.moudle.auth.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.beiming.moudle.auth.dao.ProductImageDao;
import com.beiming.moudle.auth.entity.ProductImageEntity;
import com.beiming.moudle.auth.entity.UserEntity;
import com.beiming.moudle.auth.service.ProductImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ProductImageSerivceImpl extends ServiceImpl<ProductImageDao,ProductImageEntity> implements ProductImageService {

    @Autowired
    ProductImageDao productImageDao;

    @Override
    public ProductImageEntity getProductImage(int productId) {
        QueryWrapper<ProductImageEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("product_id",productId);

        return  getOne(queryWrapper);
    }

    @Override
    public int setProductImage(ProductImageEntity productImageEntity) {

        return productImageDao.insert(productImageEntity);
    }
}
